﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;

namespace Class_KetNoi
{
   public class KetNoi_DanToc:KetNoiCoSoDuLieu
    {
       public void them_DanToc(string @TenDT)
       {
           SqlCommand cmd = new SqlCommand("dbo.insert_DanToc", cnn);
           cmd.CommandType = CommandType.StoredProcedure;
           SqlParameter p = new SqlParameter("@TenDT", TenDT);
           cmd.Parameters.Add(p);
           cmd.ExecuteNonQuery();
       }
       public void sua_DanToc(string @MaDT, string @TenDT)
       {
           SqlCommand cmd = new SqlCommand("dbo.update_DanToc", cnn);
           cmd.CommandType = CommandType.StoredProcedure;
           SqlParameter p = new SqlParameter("@MaDT",MaDT);
           cmd.Parameters.Add(p);
           p = new SqlParameter("@TenDT", TenDT);
           cmd.Parameters.Add(p);
           cmd.ExecuteNonQuery();
       }
       public void xoa_DanToc(string @MaDT)
       {
           SqlCommand cmd = new SqlCommand("dbo.delete_DanToc", cnn);
           cmd.CommandType = CommandType.StoredProcedure;
           SqlParameter p = new SqlParameter("@MaDanToc",MaDT);
           cmd.Parameters.Add(p);
           cmd.ExecuteNonQuery();
       }
       public DataTable Load_DanToc()
       {
           DataTable dt=new DataTable();
           SqlCommand cmd = new SqlCommand("Load_tbl_DanToc",cnn);
           cmd.CommandType=CommandType.StoredProcedure;
           SqlDataAdapter da=new SqlDataAdapter(cmd);
           da.Fill(dt);
           return dt;
       }
    }
}
